<?php

/**
 * Consulta form base class.
 *
 * @method Consulta getObject() Returns the current form's model object
 *
 * @package    dentist
 * @subpackage form
 * @author     Brus
 */
abstract class BaseConsultaForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'             => new sfWidgetFormInputHidden(),
      'paciente_id'    => new sfWidgetFormPropelChoice(array('model' => 'Paciente', 'add_empty' => false)),
      'consultorio_id' => new sfWidgetFormPropelChoice(array('model' => 'Consultorio', 'add_empty' => false)),
      'fecha'          => new sfWidgetFormDate(),
      'hora'           => new sfWidgetFormTime(),
      'trabajo'        => new sfWidgetFormTextarea(),
      'costo'          => new sfWidgetFormInputText(),
      'pago'           => new sfWidgetFormInputCheckbox(),
      'usuario_id'     => new sfWidgetFormPropelChoice(array('model' => 'Usuario', 'add_empty' => false)),
      'created_at'     => new sfWidgetFormDateTime(),
      'updated_at'     => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'             => new sfValidatorChoice(array('choices' => array($this->getObject()->getId()), 'empty_value' => $this->getObject()->getId(), 'required' => false)),
      'paciente_id'    => new sfValidatorPropelChoice(array('model' => 'Paciente', 'column' => 'id')),
      'consultorio_id' => new sfValidatorPropelChoice(array('model' => 'Consultorio', 'column' => 'id')),
      'fecha'          => new sfValidatorDate(),
      'hora'           => new sfValidatorTime(),
      'trabajo'        => new sfValidatorString(array('required' => false)),
      'costo'          => new sfValidatorNumber(array('required' => false)),
      'pago'           => new sfValidatorBoolean(),
      'usuario_id'     => new sfValidatorPropelChoice(array('model' => 'Usuario', 'column' => 'id')),
      'created_at'     => new sfValidatorDateTime(array('required' => false)),
      'updated_at'     => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('consulta[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Consulta';
  }


}
